import service from "@/server/serviceIndex";

// 根据条件筛选后获取实体店首页列表
export const getShopInfoList = (params) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-info/getShopInfoListByCondition`,
    params,
  });
};

// 根据条件筛选后获取实体店首页列表
export const GetelfSupport = (params) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-info/InquireShop`,
    params,
  });
};



// 根据用户id查询用户名下多少间实体店
// export const getShopNumber = (uid) => {
//   return service({
//     method: "get",
//     url: "/pipayshopapi/shop-info/getShopNumber/" + uid,
//   });
// };

// 根据用户id查询实体店列表(我的)
export const getShopList = (limit, page, uid) => {
  return service({
    method: "get",
    url: "/pipayshopapi/store-info/getShopList",
    params: {
      limit,
      page,
      uid,
    },
  });
};

// 根据id查询实体店详情
export const getShopInfoById = (shopId) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-info/getShopInfoById/${shopId}`,
  });
};

// 根据id查询实体店商品列表
export const selectShopInfoListByShopId = (shopId) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-commodity-info/selectShopInfoListByShopId/${shopId}`,
  });
};
//根据id删实体店  /pipayshopapi/shop-info/deleteShopInfoById/{shopId}
export const deleteShopInfoById = (shopId) => {
  return service({
    method: "POST",
    url: `/pipayshopapi/store-info/deleteShopInfoById/${shopId}`,
  });
};
//删除
export const deleteCommodityIdById = (commodityId) => {
  return service({
    method: "delete",
    url: `/pipayshopapi/store-commodity-info/delete/${commodityId}`,
  });
};


// 根据id查询实体店商品详情
export const selectShopInfoByCommodityId = (commodityId) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-commodity-info/selectShopInfoByCommodityId/${commodityId}`,
  });
};

// 获取所有一级分类列表
export const getShopCategoryTopList = () => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-category-top/getShopCategoryTopList`,
  });
};

// 获取实体店二级分类列表
export const getShopCategorySecList = (categoryPid) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-category/getShopCategorySecList/${categoryPid}`,
  });
};

// 根据条件筛选后获取实体店列表
export const getSecShopInfoList = (params) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-category/getSecShopInfoListByCondition`,
    params,
  });
};

// 二级分类下全部实体店列表过滤
export const getShopInfoMinList = (params) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-category-min/getShopInfoMinListByCondition`,
    params,
  });
};

// 检验是否关注
export const getIsFollowShopList = ({ shopId, userId }) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-follow-focus/isFollowShop/${shopId}/${userId}`,
  });
};

// 关注实体店
export const getUserFollowItemList = ({ followId, shopId }) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-follow-focus/userFollowItem/${followId}/${shopId}`,
  });
};
// 取消关注
export const getUserUnfollowList = ({ followId, shopId }) => {
  return service({
    method: "post",
    url: `/pipayshopapi/store-follow-focus/userUnfollow/${followId}/${shopId}`,
  });
};

// 服务收藏新增接口
export const AddShopCollection = ({ userId, commodityId }) => {
  return service({
    method: "post",
    url: `/pipayshopapi/store-collection/AddShopCollection/${userId}/${commodityId}`,
  });
};

// 校验服务是否已经被收藏接口
export const isCommodityToCollection = ({ userId, commodityId }) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-collection/isCommodityToCollection/${userId}/${commodityId}`,
  });
};

// 服务收藏删除接口
export const removeShopCollection = ({ userId, commodityId }) => {
  return service({
    method: "post",
    url: `/pipayshopapi/store-collection/removeShopCollection/${userId}/${commodityId}`,
  });
};

// new酒店列表
export const getShopInfoListByCondition = ({
  limit,
  page,
  categoryId,
  score,
  regionId,
  latitude,
  longitude,
}) => {
  return service({
    method: "post",
    url: "/pipayshopapi/shop-info/getShopInfoListByCondition",
    data: {
      limit,
      page,
      categoryId,
      score,
      regionId,
      latitude,
      longitude,
    },
  });
};


// 酒店详情
export const getShopHotelDetail = (hotelNO) => {
  return service({
    method: "get",
    url: `/pipayshopapi/shop-info/getShopInfoById/${hotelNO}`,
  });
};
// /pipayshopapi/shop-commodity-live-info/selectAllByPrice
// 根据酒店价格查询房型
export const getselectAllByPrice = (shopInfo) => {
  return service({
    method: "post",
    url: "/pipayshopapi/shop-commodity-live-info/selectAllByPrice",
    data: shopInfo,
  });
};
// 根据时间选房型
export const postRoomType = (body) => {
  return service({
    method: "post",
    url: `/pipayshopapi/shop-commodity-live-info/selectShopCommodityLiveInfoList`,
    data: body,
  });
};

// 根据shopId查找店铺的粉丝数量
export const SelectFollowShopSum = (shopId) => {
  return service({
    method: "post",
    url: `/pipayshopapi/store-follow-focus/SelectFollowShopSum/${shopId}`,
  });
};

// 根据shopId查询指定实体店还可以上传的商品数量
export const updateShopCommodity = (shopId) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-info/updateShopCommodity/${shopId}`,
  });
};

// 生成未支付订单
export const generateUnpaidShopOrder = (token) => {
  return service({
    method: "post",
    url: `/pipayshopapi/store-order/generateUnpaidOrder`,
    params: {
      token,
    },
  });
};

// 支付下单接口
export const payShopOrder = (token) => {
  return service({
    method: "post",
    url: `/pipayshopapi/store-order/payOrder`,
    params: {
      token,
    },
  });
};

// 新增网店商品的评价
export const addItemEvaluates = (dto) => {
  return service({
    method: "post",
    url: `pipayshopapi/evaluate/addItemEvaluates`,
    data: dto
  });
};

// 新增实体店商品的评价
export const addShopEvaluates = (
  userId,
  evaluate,
  commodityId,
  score,
  orderId) => {
  return service({
    method: "post",
    url: `/pipayshopapi/store-commodity-evaluate/addEvaluate?userId=${userId}&evaluate=${evaluate}&commodityId=${commodityId}&score=${score}&orderId=${orderId}`,
  });
};

// 实体店订单（未支 付 / 已支付）的详情接口
export const getShopOrderDetail = (orderId) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-order/getOrderDetail/${orderId}`,
  });
};

// 实体店详情接口
export const getStoreOrderDetail = (orderId) => {
  return service({
    method: "get",
    url: `/pipayshopapi/shop-order/getOrderDetail/${orderId}`,
  });
};

// 根据条件筛选酒店信息
export const getHotelInfoByCondition = (params) => {
  return service({
    method: "get",
    url: `/pipayshopapi/shop-info/getHotelInfoByCondition`,
    params,
  });
};
//举报实体店或者网店
export const reportShop = (data) => {
  return service({
    method: "POST",
    url: `/pipayshopapi/complaint/addComplaint`,
    data,
  });
};
//更新实体店
export const updateShopApi = (data) => {
  return service({
    method: "POST",
    url: "/pipayshopapi/store-info/updateShopInfoById",
    data,
  });
};
//上下架实体店
export const openOrCloseApi = (shopId, status) => {
  return service({
    method: "POST",
    url: `/pipayshopapi/store-info/undercarriageShopInfoById/${shopId}/${status}`,
  });
};
//上传酒店详情图片
export const roomImageUpApi = (file) => {
  return service({
    method: "POST",
    url: `/pipayshopapi/store-commodity-live-info/roomImageUp`,
    headers: { "Content-Type": "multipart/form-data" },
    data: file,
  });
};
//上传酒店房间
export const insertShopLiveInfoApi = (data) => {
  return service({
    method: "POST",
    url: `/pipayshopapi/store-commodity-live-info/insertShopLiveInfo`,
    data,
  });
};
//修改酒店房间
export const updateShopLiveAPi = (data) => {
  return service({
    method: "POST",
    url: `/pipayshopapi/store-commodity-live-info/updateHotelInfoByRoomId`,
    data,
  });
};


export const getShopLiveByRoomId = (roomId) => {
  return service({
    method: "get",
    url: `/pipayshopapi/shop-commodity-live-info/selectShopLiveByRoomId/${roomId}`,

  });
};


//酒店房间上下架删除
export const changeRoomStatus = (room) => {
  return service({
    method: "POST",
    url: "/pipayshopapi/shop-commodity-live-info/takeOffRoom",
    data: room
  })
}